Skip to main content

SetHAlign

Sets the horizontal alignment to the table.

Syntax

expression.SetHAlign(sType);

expression - A variable that represents a ApiTable class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sTypeRequiredStringHorizontal alignment type: may be "left" or "center" or "right".

Returns

boolean

Example

This example sets the horizontal alignment to the table.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetStyle(tableStyle);
doc.Push(table);
table.GetCell(0, 0).GetContent().GetElement(0).AddText("This is just a sample text.");
table.SetHAlign("center");